package chatter;

public class RealChatter implements Chatter {
	private String name;
	private String message;
	private Observer observer;

	public RealChatter(String str) {
		name = str;
		message = "Hello Cruel World!";
		observer = null;
	}

	public String getLastMessage() {
		return message;
	}

	public String getName() {
		return name;
	}

	public void sendMessage(String msg) {
		message=msg;
		if (observer!=null)
			observer.notifyEvent( new Event(msg));
	}

	public void setObserver(Observer obs) {
			observer = obs;
	}

}
